package com.topscore.uke.utils;

import com.google.gson.Gson;
import com.topscore.uke.entities.UserInfo;
import com.topscore.uke.main.BaseApplication;
import com.topscore.uke.main.Contracts;

/**
 * 用户信息管理类，用于保存和获取用户信息静态数据
 * <p>
 * Created by 71468 on 2018/3/15.
 */

public class UserInfoManager {
    private static UserInfo mUserInfo;

    public static void updateUserInfo(UserInfo userInfo) {
        String data = new Gson().toJson(userInfo);
        BaseApplication.put(Contracts._UserInfo, data);
        setUserInfo(userInfo);
    }

    public static void setUserInfo(UserInfo userInfo) {
        UserInfoManager.mUserInfo = userInfo;
    }

    public static UserInfo getUserInfo() {
        return mUserInfo;
    }
}
